package uil;

import bll.*;
import bll.Operation.Operation;
import bll.OperationFactory.AddFactory;
import bll.OperationFactory.OperationFactory;
import bll.OperationFactory.SubFactory;

import java.util.Scanner;

public class Client {
    public static void main(String[] args) {
        double numberA,numberB,result;
        String operate;

        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入numberA：");
        numberA=scanner.nextDouble();
        System.out.println("请输入您要做的运算：");
        operate=scanner.next();
        System.out.println("请输入numberB：");
        numberB=scanner.nextDouble();

        Operation opr=null;
        OperationFactory factory=null;

        switch (operate){
            case "+":
                factory=new AddFactory();
                break;
            case "-":
                factory=new SubFactory();
                break;
        }

        opr=factory.CreateOperation();

        opr.setValue(numberA,numberB);
        result= opr.getResult();

        System.out.println("运算结果是："+numberA+operate+numberB+"="+result);
    }
}
